<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>

    .container {
      position: relative;
      width: 30px;
      height: 30px;
      border: 1px solid rgba(0, 0, 0, 0.5)
    }
    .top,
    .center,
    .bottom {
      width: 80%;
      height: 2px;
      background-color: red;
      transition: all 1s;
    }

    .top {
      position: absolute;
      left: 50%;
      top:6px;
      transform: translateX(-50%);
    }

    .center {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
    }

    .bottom {
      position: absolute;
      left: 50%;
      bottom:6px;
      transform: translateX(-50%);
    }
  </style>
</head>
<body>
  <div class="container">
    <div class="top"></div>
    <div class="center"></div>
    <div class="bottom"></div>
  </div>
  <script></script>
</body>
</html>